package jk.zmn.thread.time;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

/**
 * @author 张梦楠
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: ${todo}
 * @date 2018/5/2620:09
 * @blog www.itzmn.com
 */
public class TimerDemo {

     public static void main(String[] args) throws ParseException {

         String s ="02:00:00";
         SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
         Date parse = format.parse(s);

         Timer timer = new Timer();
         timer.schedule(new TimerTask() {
             int i=1;
             @Override
             public void run() {
                 System.out.println("so easy..."+format.format(parse.getTime()-1000*i++));
             }
         },1000,1000);
     }
}
